import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
const login = r => require.ensure([], () => r(require('@/page/login')), 'login');
const manage = r => require.ensure([], () => r(require('@/page/manage')), 'manage');
const userList = r => require.ensure([], () => r(require('@/page/userList')), 'userList');
const allclass = r => require.ensure([], () => r(require('@/page/allclass')), 'allclass');
const maintotal = r => require.ensure([], () => r(require('@/page/maintotal')), 'maintotal');
const periodRulesList = r => require.ensure([], () => r(require('@/page/periodRulesList')), 'periodRulesList');
const periodRecordList = r => require.ensure([], () => r(require('@/page/periodRecordList')), 'periodRecordList');
const leaveRequestList = r => require.ensure([], () => r(require('@/page/leaveRequestList')), 'leaveRequestList');
const roomList = r => require.ensure([], () => r(require('@/page/roomlist')), 'roomList');
const notifySetting = r => require.ensure([], () => r(require('@/page/notifySetting')), 'notifySetting');
const employeeList = r => require.ensure([], () => r(require('@/page/employeeList')), 'employeeList');
const addStudent = r => require.ensure([], () => r(require('@/page/addStudent')), 'addStudent');
const studLeaveList = r => require.ensure([], () => r(require('@/page/studLeaveList')), 'studLeaveList');
const subjectList = r => require.ensure([], () => r(require('@/page/subjectList')), 'subjectList');
const norule = r => require.ensure([], () => r(require('@/page/norule')), 'norule');
const usermanage = r => require.ensure([], () => r(require('@/page/usermanage')), 'usermanage');
const basesetting = r => require.ensure([], () => r(require('@/page/basesetting')), 'basesetting');
const userDetail = r => require.ensure([], () => r(require('@/page/userDetail')), 'userDetail');
const classDetail = r => require.ensure([], () => r(require('@/page/classDetail')), 'classDetail');

const routes = [
    {
        path: '/',
        component: login
    },
    {
        path: '/manage',
        component: manage,
        name: '',
        children: [
            {
                path: '/norule',
                component: norule,
                name: '/norule',
                meta: ['权限', '没有权限'],
            },

            {
                path: '/studLeaveList',
                component: studLeaveList,
                meta: ['请假管理', '请假列表'],
            }, {
                path: '/userList/:type',
                component: userList,
                meta: ['学生管理', '学生列表'],
            },
            {
                path: '/allclass/:type',
                component: allclass,
                name: '/allclass',
                meta: ['班级管理', '班级列表'],
            },
            {
                path: '/maintotal',
                component: maintotal,
                name: '/maintotal',
                meta: ['统计管理', '统计'],
            },
            {
                path: '/leaveRequestList',
                component: leaveRequestList,
                name: '/leaveRequestList',
                meta: ['请假管理', '请假列表'],
            },
            {
                path: '/periodRulesList',
                component: periodRulesList,
                name: '/periodRuleList',
                meta: ['班级', '班级'],
            },
            {
                path: '/periodRecordList',
                component: periodRecordList,
                name: '/periodRecordList',
                meta: ['班级', '班级'],
            },
            {
                path: '/roomList',
                component: roomList,
                name: '/roomList',
                meta: ['基础设置', '教室列表'],
            },
            {
                path: '/notifySetting',
                component: notifySetting,
                name: '/notifySetting',
                meta: ['通知设置', '通知设置'],
            },
            {
                path: '/basesetting',
                component: basesetting,
                name: '/basesetting',
                meta: ['通知设置', '通知设置'],
            },
            {
                path: '/userDetail',
                component: userDetail,
                name: '/userDetail',
                meta: ['用户管理', '用户详情'],
            },
            {
                path: '/classDetail',
                component: classDetail,
                name: '/classDetail',
                meta: ['班级管理', '班级详情'],
            },
            {
                path: '/subjectList',
                component: subjectList,
                meta: ['科目管理', '添加科目'],
            },
            {
                path: '/employeeList/:type',
                component: employeeList,
                meta: ['老师管理', '老师列表'],
            },]
    }
]

export default new Router({
    routes,
    strict: process.env.NODE_ENV !== 'production',
})
